package thread;

public class SyncDemo2 {
    public static void main(String[] args) {
        Thread t1 = new Thread(Boo::doSome);
        Thread t2 = new Thread(Boo::doSome);
        t1.start();
        t2.start();
    }
    static class Boo{
        public static void doSome(){
            try {
                Thread t = Thread.currentThread();

                    System.out.println(t.getName() + "执行doSome中");
                    Thread.sleep(2000);
                synchronized (Boo.class) {
                    System.out.println(t.getName() + "执行完毕");
                    Thread.sleep(2000);
                }
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }

        }
    }
}
